//
// Created by Nasa on 2024/2/20.
//


#include<iostream>
#include<vector>

using namespace std;


int main()
{
    struct Node
    {
        int value;
        Node *next;
    };
    vector<int> l = {1, 2, 3, 4, 5};
    Node head;
    Node *p = &head;
    for (int i = 0; i < l.size(); ++i)
    {
        p->next = new Node();
        p->next->value = l[i];
        p = p->next;
    }
    // 这句话可以不写
    p->next = NULL;
    p = &head;
    int i = 0;
    while (p != NULL)
    {
        i++;
        p = p->next;
        //todo 最后会造成p是NULL 不能对空指针操作,产生错误
        cout << p->value << ',';
    }
    return 0;
}
